package zhu.areas.hatchnav.data;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import zhu.areas.dic.data.ArticleTopic;

/**
 * @hibernate.class table="T_Article" dynamic-insert="true" lazy="false"
 *                  dynamic-update="true"
 * @author Administrator
 * 
 */

public class Article implements java.io.Serializable {

	private static final long serialVersionUID = 1L;

	private int articleID;// 文章ID
	private String articleTitle;
	private String partialContent;// 截取部分文章内容
	private String articleContent;

	private ArticleTopic articleTopic;

	// private User publisher;//发布人ID
	private int publisher;

	private String publisherName;
	private Date pubTime;
	private int artType;
	private int visitNum;

	private Set articleComms = new HashSet(0);

	public Article() {

	}

	public Article(int articleID) {
		this.articleID = articleID;
	}

	public Article(int articleID, String articleTitle) {
		this.articleID = articleID;
		this.articleTitle = articleTitle;
	}

	/**
	 * @hibernate.id column="ArticleID" generator-class="increment"
	 *               unsaved-value="null"
	 * @return
	 */
	public int getArticleID() {
		return articleID;
	}

	public void setArticleID(int articleID) {
		this.articleID = articleID;
	}

	/**
	 * @hibernate.property column = "ArticleTitle" not-null="true"
	 * @return
	 */
	public String getArticleTitle() {
		return articleTitle;
	}

	public void setArticleTitle(String articleTitle) {
		this.articleTitle = articleTitle;
	}

	public String getPartialContent() {
		if (this.getArticleContent().length() < 150)
			return this.getArticleContent() + "[	完]";
		else
			return this.getArticleContent().substring(0, 150) + "......";
	}

	public void setPartialContent(String partialContent) {
		this.partialContent = partialContent;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	/**
	 * @hibernate.property column = "ArticleContent" not-null="true"
	 * @return
	 */
	public String getArticleContent() {
		return articleContent;
	}

	public void setArticleContent(String articleContent) {
		this.articleContent = articleContent;
	}

	/**
	 * @hibernate.many-to-one class="zhu.areas.dic.data.ArticleTopic"
	 *                        column="ArticleTopic" not-null="true" lazy="false"
	 */
	public ArticleTopic getArticleTopic() {
		return articleTopic;
	}

	public void setArticleTopic(ArticleTopic articleTopic) {
		this.articleTopic = articleTopic;
	}

	/**
	 * @hibernate.property column = "PublisherID" not-null="true"
	 * @return
	 */
	public int getPublisher() {
		return publisher;
	}

	public void setPublisher(int publisher) {
		this.publisher = publisher;
	}

	/**
	 * @hibernate.property column = "PublisherName" not-null="true"
	 * @return
	 */
	public String getPublisherName() {
		return publisherName;
	}

	public void setPublisherName(String publisherName) {
		this.publisherName = publisherName;
	}

	/**
	 * @hibernate.property column = "PubTime" not-null="true"
	 * @return
	 */
	public Date getPubTime() {
		return pubTime;
	}

	public void setPubTime(Date pubTime) {
		this.pubTime = pubTime;
	}

	/**
	 * @hibernate.property column = "ArtType" not-null="true"
	 * @return
	 */
	public int getArtType() {
		return artType;
	}

	public void setArtType(int artType) {
		this.artType = artType;
	}

	/**
	 * @hibernate.property column = "VisitNum" not-null="true"
	 * @return
	 */
	public int getVisitNum() {
		return visitNum;
	}

	public void setVisitNum(int visitNum) {
		this.visitNum = visitNum;
	}

	public Set getArticleComms() {
		return articleComms;
	}

	/**
	 * @hibernate.set table="T_ArtlcieComm" inverse="true" lazy="true"
	 * @hibernate.collection-key column="ArtlcieID"
	 * @hibernate.collection-one-to-many 
	 *                                   class="zhu.areas.hatchnav.data.ArticleComm"
	 */
	public void setArticleComms(Set articleComms) {
		this.articleComms = articleComms;
	}

}
